/*
 * @Author Shunzi
 * @Date 2021-07-18 01:18:30
 * @LastEditTime 2021-07-18 14:00:49
 * @LastEditors Shunzi
 * @Description
 * @FilePath /BFFNodeServer/middlewares/ErrorHandler.js
 */
const ReaultData = require("../utils/ResultData");

class ErrorHandler {
  static error(app, logger) {
    app.use((err, req, res, next) => {
      logger.error(err);
      console.log(err.message);
      res.status(500);
      res.json(new ReaultData(0, {}, "500错误,请联系管理员"));
    });
  }
}

module.exports = ErrorHandler;
